Controlling the Destruction Order of Singleton Objects

نویسنده

  • Evgeniy Gabrilovich
چکیده

Abstract The Singleton pattern [1] is a solution to (some of) the drawbacks of using global variables. Among its advantages is that the instance is always created prior to being referenced (this effectively solves the problem of initialization order when several interdependent instances are involved). This article examines some of the existing Singleton realizations in C++ and their drawbacks, and presents a solution to the complement problem, namely, the destruction order of global instances. To this end, I propose to use a Destruction Manager, so that all the singleton objects register with it, specifying interdependencies between them. Following [2], the Destruction Manager is analyzed as a composite design pattern.

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Destruction-Managed Singleton: a compound pattern for reliable deallocation of singletons

Singleton [1] is a creational pattern with well-defined semantics ensuring that the instance is always created prior to use. This effectively solves the problem of initialization order when a number of interrelated objects are involved. But the pattern’s destruction semantics is inadequate for several singletons with complex dependencies among them. A Destruction-Managed Singleton complements t...

متن کامل

Object Lifecycle Manager A Complementary Pattern for Controlling Object Creation and Destruction

Creational patterns, such as Singleton and Factory Method [1], address object construction and initialization, but do not consider object destruction. In some applications, however, object destruction is as important as object construction. The Object Lifecycle Manager pattern addresses issues associated with object destruction. Object Lifecycle Manager is also an example of a complementary pat...

متن کامل

Object Lifetime Manager A Complementary Pattern for Controlling Object Creation and Destruction

Creational patterns such as Singleton and Factory Method [1] address object construction and initialization, but do not consider object destruction. In some applications, however, object destruction is as important as object construction. The Object Lifetime Manager pattern addresses issues associated with object destruction. Object Lifetime Manager is also an example of a complementary pattern...

متن کامل

Institutional Innovations for Controlling the Institutional Destruction of Oil Shocks in Iran

In the economic literature, institutional quality and the factors affecting its changes, have become one of the important issues in economic growth of countries.One of theis factors in oil exporting countries such as Iran is oil revenues and shocks. Although in existing studies the effect of oil shocks on the destruction of Iranchr('39')s institutional quality has been accepted, few studies hav...

متن کامل

کاربرد چاپگر سه‌بعدی در بازسازی اشیای تاریخی شیشه‌ای

Three-dimensional tools are widely used for various purposes, particularly Three- dimensional printers which play a great role in simplification and acceleration of phases in production process for various fields ranging from medicine to industry. Due to the problems related to the reconstruction of missing parts in restoration of historic glass objects in the methods of molding, casting and f...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 1999